package cn.wildfirechat.app.webhook.github.pojo;

import com.google.gson.Gson;

//https://developer.github.com/v3/activity/events/types/#watchevent
public class PingEvent {
    //The action that was performed. Currently, can only be started.
    public Repository repository;
    public User sender;

    public static PingEvent fromJson(String jsonStr) {
        return new Gson().fromJson(jsonStr, PingEvent.class);
    }

    public static void main(String[] args) {
        String event = "{\"zen\":\"Mind your words, they are important.\",\"hook_id\":245889670,\"hook\":{\"type\":\"Repository\",\"id\":245889670,\"name\":\"web\",\"active\":true,\"events\":[\"push\"],\"config\":{\"content_type\":\"json\",\"insecure_ssl\":\"0\",\"url\":\"http://wildfirechat.cn:8890/github/payload\"},\"updated_at\":\"2020-09-02T08:01:11Z\",\"created_at\":\"2020-09-02T08:01:11Z\",\"url\":\"https://api.github.com/repos/heavyrain2012/account_book/hooks/245889670\",\"test_url\":\"https://api.github.com/repos/heavyrain2012/account_book/hooks/245889670/test\",\"ping_url\":\"https://api.github.com/repos/heavyrain2012/account_book/hooks/245889670/pings\",\"last_response\":{\"code\":null,\"status\":\"unused\",\"message\":null}},\"repository\":{\"id\":196691777,\"node_id\":\"MDEwOlJlcG9zaXRvcnkxOTY2OTE3Nzc=\",\"name\":\"account_book\",\"full_name\":\"heavyrain2012/account_book\",\"private\":true,\"owner\":{\"login\":\"heavyrain2012\",\"id\":34463389,\"node_id\":\"MDQ6VXNlcjM0NDYzMzg5\",\"avatar_url\":\"https://avatars0.githubusercontent.com/u/34463389?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/heavyrain2012\",\"html_url\":\"https://github.com/heavyrain2012\",\"followers_url\":\"https://api.github.com/users/heavyrain2012/followers\",\"following_url\":\"https://api.github.com/users/heavyrain2012/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/heavyrain2012/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/heavyrain2012/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/heavyrain2012/subscriptions\",\"organizations_url\":\"https://api.github.com/users/heavyrain2012/orgs\",\"repos_url\":\"https://api.github.com/users/heavyrain2012/repos\",\"events_url\":\"https://api.github.com/users/heavyrain2012/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/heavyrain2012/received_events\",\"type\":\"User\",\"site_admin\":false},\"html_url\":\"https://github.com/heavyrain2012/account_book\",\"description\":null,\"fork\":false,\"url\":\"https://api.github.com/repos/heavyrain2012/account_book\",\"forks_url\":\"https://api.github.com/repos/heavyrain2012/account_book/forks\",\"keys_url\":\"https://api.github.com/repos/heavyrain2012/account_book/keys{/key_id}\",\"collaborators_url\":\"https://api.github.com/repos/heavyrain2012/account_book/collaborators{/collaborator}\",\"teams_url\":\"https://api.github.com/repos/heavyrain2012/account_book/teams\",\"hooks_url\":\"https://api.github.com/repos/heavyrain2012/account_book/hooks\",\"issue_events_url\":\"https://api.github.com/repos/heavyrain2012/account_book/issues/events{/number}\",\"events_url\":\"https://api.github.com/repos/heavyrain2012/account_book/events\",\"assignees_url\":\"https://api.github.com/repos/heavyrain2012/account_book/assignees{/user}\",\"branches_url\":\"https://api.github.com/repos/heavyrain2012/account_book/branches{/branch}\",\"tags_url\":\"https://api.github.com/repos/heavyrain2012/account_book/tags\",\"blobs_url\":\"https://api.github.com/repos/heavyrain2012/account_book/git/blobs{/sha}\",\"git_tags_url\":\"https://api.github.com/repos/heavyrain2012/account_book/git/tags{/sha}\",\"git_refs_url\":\"https://api.github.com/repos/heavyrain2012/account_book/git/refs{/sha}\",\"trees_url\":\"https://api.github.com/repos/heavyrain2012/account_book/git/trees{/sha}\",\"statuses_url\":\"https://api.github.com/repos/heavyrain2012/account_book/statuses/{sha}\",\"languages_url\":\"https://api.github.com/repos/heavyrain2012/account_book/languages\",\"stargazers_url\":\"https://api.github.com/repos/heavyrain2012/account_book/stargazers\",\"contributors_url\":\"https://api.github.com/repos/heavyrain2012/account_book/contributors\",\"subscribers_url\":\"https://api.github.com/repos/heavyrain2012/account_book/subscribers\",\"subscription_url\":\"https://api.github.com/repos/heavyrain2012/account_book/subscription\",\"commits_url\":\"https://api.github.com/repos/heavyrain2012/account_book/commits{/sha}\",\"git_commits_url\":\"https://api.github.com/repos/heavyrain2012/account_book/git/commits{/sha}\",\"comments_url\":\"https://api.github.com/repos/heavyrain2012/account_book/comments{/number}\",\"issue_comment_url\":\"https://api.github.com/repos/heavyrain2012/account_book/issues/comments{/number}\",\"contents_url\":\"https://api.github.com/repos/heavyrain2012/account_book/contents/{+path}\",\"compare_url\":\"https://api.github.com/repos/heavyrain2012/account_book/compare/{base}...{head}\",\"merges_url\":\"https://api.github.com/repos/heavyrain2012/account_book/merges\",\"archive_url\":\"https://api.github.com/repos/heavyrain2012/account_book/{archive_format}{/ref}\",\"downloads_url\":\"https://api.github.com/repos/heavyrain2012/account_book/downloads\",\"issues_url\":\"https://api.github.com/repos/heavyrain2012/account_book/issues{/number}\",\"pulls_url\":\"https://api.github.com/repos/heavyrain2012/account_book/pulls{/number}\",\"milestones_url\":\"https://api.github.com/repos/heavyrain2012/account_book/milestones{/number}\",\"notifications_url\":\"https://api.github.com/repos/heavyrain2012/account_book/notifications{?since,all,participating}\",\"labels_url\":\"https://api.github.com/repos/heavyrain2012/account_book/labels{/name}\",\"releases_url\":\"https://api.github.com/repos/heavyrain2012/account_book/releases{/id}\",\"deployments_url\":\"https://api.github.com/repos/heavyrain2012/account_book/deployments\",\"created_at\":\"2019-07-13T07:23:26Z\",\"updated_at\":\"2020-09-02T07:56:00Z\",\"pushed_at\":\"2020-09-02T07:55:58Z\",\"git_url\":\"git://github.com/heavyrain2012/account_book.git\",\"ssh_url\":\"git@github.com:heavyrain2012/account_book.git\",\"clone_url\":\"https://github.com/heavyrain2012/account_book.git\",\"svn_url\":\"https://github.com/heavyrain2012/account_book\",\"homepage\":null,\"size\":84,\"stargazers_count\":0,\"watchers_count\":0,\"language\":null,\"has_issues\":true,\"has_projects\":true,\"has_downloads\":true,\"has_wiki\":true,\"has_pages\":false,\"forks_count\":0,\"mirror_url\":null,\"archived\":false,\"disabled\":false,\"open_issues_count\":0,\"license\":null,\"forks\":0,\"open_issues\":0,\"watchers\":0,\"default_branch\":\"master\"},\"sender\":{\"login\":\"heavyrain2012\",\"id\":34463389,\"node_id\":\"MDQ6VXNlcjM0NDYzMzg5\",\"avatar_url\":\"https://avatars0.githubusercontent.com/u/34463389?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/heavyrain2012\",\"html_url\":\"https://github.com/heavyrain2012\",\"followers_url\":\"https://api.github.com/users/heavyrain2012/followers\",\"following_url\":\"https://api.github.com/users/heavyrain2012/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/heavyrain2012/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/heavyrain2012/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/heavyrain2012/subscriptions\",\"organizations_url\":\"https://api.github.com/users/heavyrain2012/orgs\",\"repos_url\":\"https://api.github.com/users/heavyrain2012/repos\",\"events_url\":\"https://api.github.com/users/heavyrain2012/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/heavyrain2012/received_events\",\"type\":\"User\",\"site_admin\":false}}";
        PingEvent watchEvent = fromJson(event);
        System.out.println("");
    }
}
